/**
 * 
 */
package com.byzk.p2p.admin.log.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.byzk.p2p.admin.base.util.PageInfo;
import com.byzk.p2p.admin.group.dto.Group;
import com.byzk.p2p.admin.log.dao.ThirdMsgRecordDao;
import com.byzk.p2p.admin.log.dto.ThirdMsgRecord;

/*** <p>Title:ThirdMsgRecordService </p>
* <p>Description: 第三方消息推送服务</p>
* <p>Company:xbd </p>
* @author:Administrator
* @date:2016年10月18日上午10:08:11 */
@Service
public class ThirdMsgRecordService {

	@Autowired
	private ThirdMsgRecordDao thirdMsgRecordDao;
	
	/**
	 * 
	* <p>Description:第三方消息推送列表</p>
	* <p>Company:xbd </p>
	* @author:lilei
	* @date:2016年10月18日上午10:17:41
	 */
	public PageInfo<ThirdMsgRecord> getRecordList(Map<String, Object> queryMap, Integer index, Integer limit) {

		if (index != null && limit != null) {
			if (queryMap == null) {
				queryMap = new HashMap<String, Object>();
			}
			queryMap.put("start", (index - 1) * limit);
			queryMap.put("limit", limit);
		}
		Integer total = thirdMsgRecordDao.count(queryMap);
		List<ThirdMsgRecord> list = thirdMsgRecordDao.recordList(queryMap);
		PageInfo<ThirdMsgRecord> pageInfo = new PageInfo<ThirdMsgRecord>(total, index, limit);
		pageInfo.setPageList(list);
		return pageInfo;
	}
	
	/**
	 * 
	* <p>Description:查询三方推送记录 </p>
	* <p>Company:xbd </p>
	* @author:lilei
	* @date:2016年10月18日下午1:32:06
	 */
   public PageInfo<ThirdMsgRecord> getRecordListByTerm(Map<String,Object>reqParam,Integer index, Integer limit){
	   
	   if(index!=null &&limit!=null){
		   if(reqParam==null){
			   reqParam = new HashMap<String,Object>();
		   }
		   reqParam.put("start", (index-1)*limit);
		   reqParam.put("limit", limit);
	   }
	   Integer total = thirdMsgRecordDao.count(reqParam);
	   List<ThirdMsgRecord> list = thirdMsgRecordDao.recordListByTerm(reqParam);
	   PageInfo<ThirdMsgRecord> pageInfo = new PageInfo<ThirdMsgRecord>(total,index,limit);
	   pageInfo.setPageList(list);
	   return pageInfo;
   }

}
